#include<stdio.h>
#include<string.h>
#include<readline/readline.h>
#include<readline/history.h>
/*
函数三要素
       1.函数名
       2.函数参数
       3.函数返回值
*/
int main()
{   /*打开文件*/
    FILE*fp = fopen("./home/259ClassBasic/BasiC/259-class-basic/BasiCFile/test.txt","r");
    if(fp == NULL)
    {   /*标准出错*/
        perror("open error");
        return 0;
    }
#if 0
    char buffer [20] = {0};

    fread(buffer,1,strlen(buffer),fp);
    printf("buffer:%s\n",buffer);

#else
     char *buffer = NULL;
     size_t size = 0;

     while (getline(&buffer,&size,fp))
     {
       if(feof(fp) == 1)
       {
        break;
       }
       printf("buffer:%s",buffer);
     }
     
     
#endif

      

       
        



    /*关闭文件*/
    fclose(fp);
    
    


    return 0;
}